<?php

class GearMaint_View extends Base_View
{
	public function __construct()
	{
		parent::__construct();
	}
	
	public function doView()
	{
		$this->doGearList();
	}
	
	private function doGearList()
	{
		$list = $this->data['gear'];
		$hrow = $list[0];
		

		?>
		<table>
		<? $this->doTableHead($this->hrow); ?>
		<tbody>
		<?php
		
		foreach ($list as $record)
		{
			echo '<tr>';
			foreach ($record as $field)
			{
				echo "<td> $field </td> ";
			}
			echo '</tr>';
		}
		?>
		</tbody>
		</table>
		<?php 		
		
	}
	
	private function doGearForm()
	{
		$ct = count( $this->data['fields']);
		?>
		<table><tbody>
		<?php
		for ($i=0; $i < $ct /2; $i++)
		{
			$f1 = $this->data['fields'][$i];
			$f2 = $this->data['fields'][ $ct - $i];
			?>
			
			<?php	
		}
	}
	
	private function doTableHead( $assoc_row)
	{
		?>	<thead><tr>		<?
		$fields = array_keys($assoc_row);
		foreach($fields as $f)
		{
			?>	<th> <?= $f ?> </th>	<?
		}
		?>   </tr></thead>	<?
	}
}	//end of class